<?php
    //接受数据
    $id=$_POST['id'];
    $password=$_POST['password'];
    //到数据库验证建立连接
    $con=mysql_connect('localhost', 'root', 'dx123');
    if(!$con)
    {
        die("出错了".mysql_errno());   
    }
    //选择数据库
    mysql_select_db("empmanage");
    //构建sql语句
    $sql="select password,name from admins where id=$id";
   //echo $sql; 
   //查询
   mysql_query("set names utf8");
    $res=mysql_query($sql,$con);
    //var_dump($res);
    if(!empty($res))
    {
        $row=mysql_fetch_row($res);
        if($row[0]==md5($password))
        {
            //echo $row[0];
            header("Location:manageview.php?name=$row[1]");
            exit();
        }
    }
    header("Location:login.php?error=1");
    exit();